<center>
	<?php 
		if(!isset($_POST["user"]))	//没有内容显示表单
		{
	 ?>
	<table border="1">
		<form action="install.php" method="post">
			<tr>
				<td colspan="2" align="center">输入管理员信息</td>
			</tr>
			<tr>
				<td>输入管理员名称:</td>
				<td>
					<input type="text" name="user">
				</td>
			</tr>
			<tr>
				<td>输入管理员密码:</td>
				<td>
					<input type="password" name="pass">
				</td>
			</tr>
			<tr>
				<td colspan="2">
					<input type="submit" value="开始安装">
				</td>
			</tr>
		</form>
	</table>
	<?php 
	 }
	 else
	 {
		 include "config.php";
		 // 初始化创建表
		 $sql1 = "create table $test_user(
		 `id` int(6) not null auto_increment primary key,
		 `name` varchar(12) not null default '',
		 `pass` varchar(12) not null default '',
		 `admin` int(1) not null default 0
		 )engine=InnoDB default charset=gb2312";
		 $step1=$mysqli->query($sql1) or die($mysqli->error);
		 
		 $sql2="create table $test_question(
		 `id` int(6) not null auto_increment primary key,
		 `content` varchar(200) not null default '',
		 `type` int(1) not null default 0,
		 `answer` int(1) not null default 0
		 )engine=InnoDB default charset=gb2312";
		 $step2=$mysqli->query($sql2) or die($mysqli->error);
		 
		 $sql3="create table $test_answer(
		 `id` int(6) not null auto_increment primary key,
		 `content` varchar(200) not null default '',
		 `question` int(5) not null default 0,
		 `answer` int(1) not null default 0
		 )engine=InnoDB default charset=gb2312";
		 $step3=$mysqli->query($sql3) or die($mysqli->error); 
		 
		 $sql4="create table $test_exam(
		 `id` int(6) not null auto_increment primary key,
		 `name` varchar(12) not null default '',
		 `score` int(5) not null default 0,
		 `date` varchar(20) not null default ''
		 )engine=InnoDB default charset=gb2312";
		 $step4=$mysqli->query($sql4) or die($mysqli->error); 
		 
		 // 填入管理员信息
		 $user=$_POST["user"];
		 $pass=$_POST["pass"];
		 
		 $sql5 = "insert into $test_user(name,pass,admin) values ('$user','$pass',1)";
		 $sql5 = $mysqli->query($sql5) or die($mysqli->error);
		 // if($step1 and $step2 and $step3 and $step4 and $step5){
			 echo "成功安装";
			 echo "管理员名称为:$user";
			 echo "点击<a href='index.php'>这里</a>进入系统";
		 // }
	 }
	 
	 
	 ?>
</center>